package com.cupcakeengine.events
{
	import flash.utils.Dictionary;
	
	public class EventHolder
	{
		private var _type		 		: String;
		private var _evtListeners 		: Dictionary	 = null;
		
		public function get type () 		: String { return _type; }
		
		public function EventHolder(type : String)
		{
			_type 		= type;
		}
		
		public function addEvtListener ( key : Object, value : Object ) : Boolean
		{
			if (!_evtListeners) _evtListeners = new Dictionary(true);			
			
			_evtListeners[key] = value;
			return true;
		}
		
		public function removeEvtListener ( key : Object ) : Boolean
		{
			_evtListeners[key] = null;
			
			return true;
		}
		
		public function getEvtListener ( key : Object ) : Object
		{
			return _evtListeners[key];
		}
		
		public function isRegisteredEvtListener ( key : Object ) : Boolean
		{
			return (_evtListeners[key] != null || _evtListeners[key] != undefined);
		}
		
		public function get eventListeners () : Dictionary { return _evtListeners; }
	}
}